package com.ruoyi.common.config;

import com.eic.framework.security.LoginJwtHandler;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取JWT相关配置
 *
 */
@Component
@ConfigurationProperties(prefix = "token")
public class TokenConfig {
    //令牌自定义标识
    private static String header;
    // 令牌密钥
    private static String secret;
    // 令牌有效期（默认720分钟）
    private static int expireTime;

    public static String getHeader() {
        return header;
    }

    public void setHeader(String header) {
        this.header = header;
    }

    public static String getSecret() {
        return secret;
    }

    public void setSecret(String secret) {
        LoginJwtHandler.setSecretKey(secret);
        this.secret = secret;
    }

    public static int getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(int expireTime) {
        LoginJwtHandler.setExpireMinutes(expireTime);
        this.expireTime = expireTime;
    }
}
